﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsMobile.PocketOutlook;
using PlaxoSyncWM;
using Contact=PlaxoSyncWM.Contact;

namespace TestPlaxoSyncWM {
    
    [TestClass]
    public class TestContact {
        public Contact c1, c2, c3, c4;
        public ContactCollection mcol;
        public OutlookSession os;
        public MobileContactsFile mcf;

        [TestInitialize]
        public void InitializeMe() {
            os = new OutlookSession();
            if (os.Contacts.Items != null)
                os.Contacts.Items.Clear();
            c1 = new Contact("Kiran", "Bellubbi", "312-265-6852");
            c2 = new Contact("Karen", "Bellubbi", "07940904211");
            c3 = new Contact("Eugene", "Dsouza", "07999900090");
            mcf = new MobileContactsFile();
        }

        [TestMethod]
        public void testAdd() {
            c1.Persist();
            c2.Persist();
            c3.Persist();
            if (!mcf.mobileContactsFileExists()) {
                mcf.create();
            }
            Assert.AreEqual(3, os.Contacts.Items.Count);
            os.Dispose();
        }
        #region Additional test attributes

        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //

        #endregion
    }
}